package struts2.validation;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @Description：
 * @author：涂有
 * @date 2015年11月6日 上午11:46:41
 */
public class FieldValidation extends ActionSupport{

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	private String name;
	private String password;
	
	@Override
	public String execute() throws Exception {
		
		return SUCCESS;
	}
	
	public String login() throws Exception{
		
		return INPUT;
	}
	
	@Override
	public void validate() {
		
		addActionError(getText("name"));
		addFieldError("name", getText("name"));
		addFieldError("password", getText("password"));
		super.validate();
	}
}
